{% extends 'base.html' %}

{% block title %}{{ blog_article.title }}{% endblock title %}

{% block content %}
<h1>{{ blog_article.title }}</h1>
<p>作者：{{ blog_article.author }}</p>
<p>创建时间：{{ blog_article.createTime }}</p>
<br>
<span>阅读数：{{ article.views }}</span>
<br>
<span>分类：
    {% if blog_article.category %}
    <a href="{% url 'blog:category' blog_article.category.pk %}">{{ blog_article.category }}</a>
    {% else %}
    未分类
    {% endif %}
</span>
<span>标签：
    {% if blog_article.tags.get_queryset %}
    {% for tag in blog_article.tags.get_queryset %}
    <a href="{% url 'blog:tag' tag.pk %}">{{ tag.tag }}</a>
    {% if not forloop.last %}
    <span>·</span>
    {% endif %}
    {% endfor %}
    {% else %}
    无标签
    {% endif %}
</span>
{% if blog_article.toc %}
<div>
    <h3>文章目录</h3>
    <div>
        <ul>
            {{ blog_article.toc|safe }}
        </ul>
    </div>
</div>
{% else %}
<h3>没有目录</h3>
{% endif %}
<br>
<p>{{ blog_article.body|safe }}</p>
{% endblock content %}